//
// Created by xili on 2024/8/29 21:26.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int minimumBoxes(vector<int> &apple, vector<int> &capacity) {
        int sum = accumulate(apple.begin(), apple.end(), 0);
        sort(capacity.begin(), capacity.end(), greater());
        int i = 0;
        while (sum > 0) {
            sum -= capacity[i++];
        }
        return i;
    }
};